package fit.acmetelecom.fakes;

import java.math.BigDecimal;
import java.util.List;

import com.acmetelecom.core.BillGenerator;
import com.acmetelecom.core.LineItem;
import com.acmetelecom.customer.Customer;

public class FakeBillGenerator extends BillGenerator {

	public FakeBillGenerator(FakeHtmlPrinter printer) {
		super(printer);
	}
	
	@Override
	public void send(Customer customer, List<LineItem> calls) {   
		BigDecimal totalBill = BigDecimal.ZERO;
		for(LineItem item : calls) totalBill = totalBill.add(item.cost());
        for(LineItem call : calls) {
        	((FakeHtmlPrinter)printer).printRow(customer, call.date(), call.callee(), 
        			call.durationMinutes(), call.cost(),
        			totalBill);
        }
	}
}
